package com.hjxr.sysadmin.zsj.controller;

import java.util.List;

import com.hjxr.framework.web.domain.AjaxResult;
import com.hjxr.sysadmin.uitl.poi.ExcelUtil;
import com.hjxr.sysadmin.web.controller.BaseController;
import com.hjxr.sysadmin.web.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hjxr.framework.aspectj.lang.annotation.Log;
import com.hjxr.framework.aspectj.lang.enums.BusinessType;
import com.hjxr.sysadmin.zsj.domain.ParkPolygon;
import com.hjxr.sysadmin.zsj.service.IParkPolygonService;

/**
 * 园区画图坐标Controller
 *
 * @author hjxr
 * @date 2021-03-31
 */
@Api("园区画图坐标Controller")
@RestController
@RequestMapping("/parkpolygon")
public class ParkPolygonController extends BaseController
{
    @Autowired
    private IParkPolygonService parkPolygonService;

    /**
     * 查询园区画图坐标列表
     */
//    @PreAuthorize("@ss.hasPermi('zsj:parkpolygon:list')")
    @ApiOperation(" 查询园区画图坐标列表")
    @GetMapping("/list")
    public TableDataInfo list(ParkPolygon parkPolygon)
    {
        startPage();
        List<ParkPolygon> list = parkPolygonService.selectParkPolygonList(parkPolygon);
        return getDataTable(list);
    }

    /**
     * 导出园区画图坐标列表
     */
//    @PreAuthorize("@ss.hasPermi('zsj:parkpolygon:export')")
    @Log(title = "园区画图坐标", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(ParkPolygon parkPolygon)
    {
        List<ParkPolygon> list = parkPolygonService.selectParkPolygonList(parkPolygon);
        ExcelUtil<ParkPolygon> util = new ExcelUtil<ParkPolygon>(ParkPolygon.class);
        return util.exportExcel(list, "parkpolygon");
    }

    /**
     * 获取园区画图坐标详细信息
     */
//    @PreAuthorize("@ss.hasPermi('zsj:parkpolygon:query')")
    @GetMapping(value = "/{parkPolygonId}")
    public AjaxResult getInfo(@PathVariable("parkPolygonId") Long parkPolygonId)
    {
        return AjaxResult.success(parkPolygonService.selectParkPolygonById(parkPolygonId));
    }

    /**
     * 新增园区画图坐标
     */
//    @PreAuthorize("@ss.hasPermi('zsj:parkpolygon:add')")
    @Log(title = "园区画图坐标", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ParkPolygon parkPolygon)
    {
        return toAjax(parkPolygonService.insertParkPolygon(parkPolygon));
    }

    /**
     * 修改园区画图坐标
     */
//    @PreAuthorize("@ss.hasPermi('zsj:parkpolygon:edit')")
    @Log(title = "园区画图坐标", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ParkPolygon parkPolygon)
    {
        return toAjax(parkPolygonService.updateParkPolygon(parkPolygon));
    }

    /**
     * 删除园区画图坐标
     */
//    @PreAuthorize("@ss.hasPermi('zsj:parkpolygon:remove')")
    @Log(title = "园区画图坐标", businessType = BusinessType.DELETE)
	@DeleteMapping("/{parkPolygonIds}")
    public AjaxResult remove(@PathVariable Long[] parkPolygonIds)
    {
        return toAjax(parkPolygonService.deleteParkPolygonByIds(parkPolygonIds));
    }
}
